// -*- mode:objc -*-
// $Id: ITTerminal.h,v 1.5 2003/08/13 05:05:43 sgehrman Exp $
/*
 **  ITTerminal.h
 **
 **  Copyright (c) 2002, 2003
 **
 **  Author: Fabian, Ujwal S. Sathyam
 **	     Initial code by Kiichi Kusama
 **
 **  Project: iTerm
 **
 **  Description: Session and window controller for iTerm.
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License as published by
 **  the Free Software Foundation; either version 2 of the License, or
 **  (at your option) any later version.
 **
 **  This program is distributed in the hope that it will be useful,
 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 **  GNU General Public License for more details.
 **
 **  You should have received a copy of the GNU General Public License
 **  along with this program; if not, write to the Free Software
 **  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#import <Cocoa/Cocoa.h>
#import "PTYTabView.h"

@class ITSessionMgr, PTYSession, ITTerminalView, ITSessionDesc;

@interface ITTerminal : NSObject <PTYTabViewDelegateProtocol>
{
    ITTerminalView* _terminalView;

    ITSessionMgr* _sessionMgr;
    
    BOOL tabViewDragOperationInProgress;
}

- (id)initWithFrame:(NSRect) frame;

- (void)openSessionWithDesc:(ITSessionDesc*)desc;

- (ITTerminalView*)terminalView;

- (NSArray*)ttyPIDs:(BOOL)currentSessionOnly;
- (NSArray*)ttyNames:(BOOL)currentSessionOnly;
- (NSArray*)ttyFileDescs:(BOOL)currentSessionOnly;

- (void)insertSession: (PTYSession *) aSession atIndex: (int) index;
- (void)insertSession:(PTYSession *)aSession;

- (void)selectSession:(PTYSession *)aSession;
- (void)selectSessionAtIndex:(int)sessionIndex;
- (void)closeSession:(PTYSession*)aSession;
- (IBAction)closeCurrentSession:(id)sender;

- (PTYSession *)currentSession;
- (int)currentSessionIndex;
- (NSString *)currentSessionName;
- (void)setCurrentSessionName: (NSString *) theSessionName;

- (void)startProgram:(NSString *)program;
- (void)startProgram:(NSString *)program
           arguments:(NSArray *)prog_argv;
- (void)startProgram:(NSString *)program
                  arguments:(NSArray *)prog_argv
                environment:(NSDictionary *)prog_env;

- (ITSessionMgr*)sessionMgr;

- (void)clearBuffer:(id)sender;
- (void)clearScrollbackBuffer:(id)sender;
- (IBAction)logStart:(id)sender;
- (IBAction)logStop:(id)sender;
- (BOOL)validateMenuItem:(NSMenuItem *)item;

// NSTabView
- (void)closeTabContextualMenuAction: (id) sender;
- (void)moveTabToNewWindowContextualMenuAction: (id) sender;

@end
